package com.ddwl.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Fu Zhaohui
 * @version 1.0.0
 * @date 2019/6/27 10:55
 */
public interface UserEnum {

    @AllArgsConstructor
    @Getter
    enum LocationStatusEnum {
        LATEST("最新", (byte) 1),
        EXPIRE("过期", (byte) 0),
        ;
        private String name;
        private Byte code;
    }

    @AllArgsConstructor
    @Getter
    enum DictionaryField {

        ;

        private String code;
        private String name;
        private Object defaultVal;
    }

    @AllArgsConstructor
    @Getter
    enum UserStatus {
        NUL(0, "未绑定"),
        PRE(1, "绑定中"),
        SUCCEED(2, "绑定通过"),
        FILL(3, "绑定失败"),
        ;
        private Integer code;
        private String name;
    }

    @AllArgsConstructor
    @Getter
    enum ProfitLevelEnum {
        NORMAL(0, "普通用户",""),
        PERSONAL(1, "个人代理","SYSTEM_SHOP_PERSONAL_AGENT_PROFIT"),
        STORE(2, "店铺代理","SYSTEM_SHOP_STORE_AGENT_PROFIT"),
        ZONE(3, "区域合伙人","SYSTEM_SHOP_ZONE_AGENT_PROFIT"),
        PARTNER(4, "永久合伙人",""),
        ;
        private Integer level;
        private String name;
        /**
         * 代理商品分润时获取分润比例时使用
         */
        private String profitName;

        public static ProfitLevelEnum getLevel(Integer level) {
            for (ProfitLevelEnum profitLevelEnum : ProfitLevelEnum.values()) {
                if (profitLevelEnum.getLevel().equals(level)) {
                    return profitLevelEnum;
                }
            }
            return null;
        }
    }

    @AllArgsConstructor
    @Getter
    enum UserTypeEnum {

        /**
         * 区域合伙人
         */
        REGION(2),
        /**
         * 分销员
         */
        DIST(1),
        /**
         * 普通会员
         */
        MEMBER(0),
        ;

        private Integer value;

        public static UserTypeEnum getByValue(String value) {
            for (UserTypeEnum resultEnum : UserTypeEnum.values()) {
                if (resultEnum.getValue().equals(value)) {
                    return resultEnum;
                }
            }
            throw new IllegalArgumentException("枚举:" + SmsCaptchaNodeEnum.class.getSimpleName() + "不包含value:" + value);
        }
    }

    @AllArgsConstructor
    @Getter
    enum AccountEnum {
        /**
         * 公益帐户
         */
        CHARITY_ACCOUNT("1600660524362640128", "19157811805", "公益帐户"),
        /**
         * 公司店铺账户
         */
        SHOP_ACCOUNT("1600559027438045184", "19157818805", "公司店铺"),

        ;

        private String id;
        private String mobile;
        private String name;

    }

    @AllArgsConstructor
    @Getter
    enum ConnectEnum {
        CONNECTED(1, "已连接"),
        DIS_CONNECT(0, "未连接"),
        ;
        private Integer code;
        private String name;
    }

}
